package ru.nlezhnev.services;
import ru.nlezhnev.services.request_processor.AddFriends;
import ru.nlezhnev.services.request_processor.DeleteOldActions;
import ru.nlezhnev.services.request_processor.InitUser;
import ru.nlezhnev.services.request_processor.NullProcessor;
import ru.nlezhnev.services.request_processor.UpdateData;
import flex.messaging.io.amf.ASObject;

public class Farm {	
	public ASObject initUser(byte[] data, String vid) {
		InitUser processor = new InitUser(data, vid, "farm.initUser");
		return processor.getResult();
	}
	
	public ASObject updateData(byte[] data, String vid) {
		UpdateData processor = new UpdateData(data, vid, "farm.updateData");
		return processor.getResult();
	}
	
	public ASObject addFriends(byte[] data, String vid) {
		AddFriends processor = new AddFriends(data, vid, "farm.addFriends");
		return processor.getResult();
	}
		
	public ASObject deleteOldActions(byte[] data, String vid) {
		DeleteOldActions processor = new DeleteOldActions(data, vid, "farm.deleteOldActions");
		return processor.getResult();
	}
	
	
	
	public ASObject exchangeVotes(byte[] data, String vid) {
		NullProcessor processor = new NullProcessor(data, vid, "farm.exchangeVotes");
		return processor.getResult();
	}
	
	@SuppressWarnings("unchecked")
	public ASObject addRatings(byte[] data, String vid) {
		ASObject response = new ASObject();
		
		response.put("response", new Object[1]);
		response.put("method", "farm.addRatings");
		return response;
	}
}

//merge test
//ASObject testCommonField = new ASObject();
//testCommonField.put("test", 777);
//ASObject testAdd = new ASObject();
//testAdd.put("common", testCommonField);		
//MergeData.merge(farm.getData(), testAdd);